byteXor
Type
operator
Summary
Performs a "bitwise xor" operation on each bit of two strings of binary data.
Syntax
<leftData> byteXor <rightData>
Description
Use the byteXor operator to operate directly on the bits of two binary strings.
For each bit of leftData, LiveCode performs an xor operation with the corresponding bit of rightData to produce a result. A bit is 1 if one of the corresponding bits of leftData and rightData are 1. Otherwise, the bit is 0.
If the leftData and rightData are different lengths, the bytes of the shorter binary string are repeatedly used in order to produce the result.
Parameters
Name | Type | Description |
---|---|---|
leftData | binary data, or an expression that evaluates to binary data | |
rightData | binary data, or an expression that evaluates to binary data |
Examples
/* Left data represented in memory as 00000011 00000010 */
local tLeftData
put numToByte(3) & numToByte(2) into tLeftData
/* Right data represented in memory as 00000010 00000001 */
local tRightData
put numToByte(2) & numToByte(1) into tRightData
/* Result represented in memory as 00000001 00000011 */
local tResult
put tLeftData byteXor tRightData into tResult
/* Equivalent to using bitXor and then converting to data */
put tResult is numToByte(3 bitXor 2) & numToByte(2 bitXor 1) -- true
Related
glossary: operation, operator, bit, binary, operand, binary data
Compatibility and Support
Introduced
LiveCode 10.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile